home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / answers / linux-faq / part6 < prev    next >
Encoding:
Text File  |  1993-06-11  |  39.5 KB  |  1,051 lines

  1. Newsgroups: comp.os.linux,comp.os.linux.announce,comp.answers,news.answers
  2. Path: senator-bedfellow.mit.edu!enterpoop.mit.edu!uhog.mit.edu!wupost!howland.reston.ans.net!agate!doc.ic.ac.uk!uknet!mcsun!julienas!geocub!labri.greco-prog.fr!corsini
  3. From: corsini@labri.greco-prog.fr
  4. Subject: Linux Frequently Asked Questions 6/6 [monthly posted]
  5. Message-ID: <PART6_739793198@geocub.greco-prog.fr>
  6. Followup-To: poster
  7. Summary: Linux, a small and free unix-like for 386-AT computers.
  8. Sender: corsini@greco-prog.fr (Marc-Michel CORSINI)
  9. Reply-To: linux@numero6.greco-prog.fr
  10. Organization: Greco Prog. CNRS & LaBRI, Bordeaux France
  11. Date: Fri, 11 Jun 1993 10:06:42 GMT
  12. Approved: news-answers-request@MIT.Edu
  13. Expires: Sun, 25 Jul 1993 10:06:38 GMT
  14. Lines: 1034
  15. Xref: senator-bedfellow.mit.edu comp.os.linux:45908 comp.os.linux.announce:782 comp.answers:958 news.answers:9312
  16.  
  17. Archive-name: linux-faq/part6
  18.  
  19. Last-Modified: 93/06/11
  20. Version: 1.19
  21.  
  22. *********************************************************
  23. *                            *
  24. *   Answers to Frequently asked questions about Linux   *
  25. *                            *
  26. *********************************************************
  27.  
  28. This post contains Part 6 of the Linux FAQ (6 parts).
  29. It must be read *after* the 5 first parts. 
  30.  
  31. ===================================8<====>8============================
  32. CONTENTS (of this part)
  33.  
  34.     XIV.    EVERYTHING FOR PRINTING        (part5)
  35.     XV.    UUCP/NEWS/MAIL for LINUX    (part6)
  36.  
  37. ===================================8<====>8============================
  38.  
  39.  
  40.  
  41. XIV.  EVERYTHING FOR PRINTING
  42. =============================
  43. **** This is the lpd FAQ version 1.3 (last update 8th june), this
  44. **** section is maintained by Brian McCauley. Please send any
  45. **** suggestion to: B.A.McCauley@bham.ac.uk
  46.  
  47.  XIV.01)  What _is_ the Linux lpr/lpd package?
  48.  
  49. ANSWER: To quote the net-FAQ:
  50.  
  51. Lpr is a utility that is used to print files out to local and remote
  52. printers. As with all networking, there are configuration files which
  53. have to be tailored to your needs. These files are concerned with
  54. access control, accounting and page setup of your printer(s).  Now all
  55. control of the printer is performed by a process called lpd
  56.  
  57. Lpd is a laser printer daemon (yes I know an epson isn't a laser
  58. printer but thats besides the point). The program lpd is normally
  59. started in /etc/rc.local in either the forground or the background.
  60. What happens is that lpd will sink back as a daemon, only ever being
  61. invoked when a printer request is generated. lpd itself has some
  62. options which are of possible intrest to some people chiefly that of
  63. the '-l' flag which causes lpd to log requests recieved from the
  64. network (useful for debugging). The other option is for what port lpd
  65. should listen for data on and is generally not used.
  66.  
  67. [ Note: lp really stands for line printer but as technology has
  68. advanced laser printer makes more sense. Note also that lpr can be
  69. used for queuing requests to use any specialised resource on a network
  70. not just hardcopy output devices. ]
  71.  
  72.  
  73.  XIV.02)  What is _the_ Linux lpr/lpd package?
  74.  
  75. ANSWER: Up until 28th May 1993, as far as there is a definitive Linux
  76. version of anything _the_ Linux lpr/lpd is <bir7@leland.stanford.edu>
  77. Ross Biro's port of the BSD sources dated 20th November 1992 (so if
  78. you're used to AT&T's you'll find some differences).  Ross's binaries
  79. and the diffse wer found in:
  80.  
  81. tsx-11.mit.edu:pub/linux/binaries/usr.bin/lpr.tar.Z
  82. sunsite.unc.edu:pub/Linux/system/Daemons/lpr.tar.Z
  83.  
  84. The SLS file lpr.tgz on disk b2 contained the same stuff.
  85.  
  86. In addition to the standard BSD lpr capabilities Ross Biro's port
  87. should have had better support for serial printers (but it didn't work
  88. in the old binaries).
  89.  
  90. Ross's port was not based on the latest BSD sources (by about 3 years,
  91. '88 vs '91). His new release will also be based on these sources which
  92. can be found are at:
  93.  
  94. gatekeeper.dec.com and /afs/ir.stanford.edu/src/...
  95.  
  96. However this changed as of about 28th May 1993 so from now on this
  97. version will be called the "old" binaries. On or about that date two
  98. different new releases of lpd appeared. One of these was a version of
  99. Ross's with bug fixes in:
  100.  
  101. sunsite.unc.edu:pub/Linux/system/Daemons/lpr.tar.z
  102. tsx-11.mit.edu:pub/linux/binaries/usr.bin/lpr.tar.z
  103.  
  104. The other is a port of the '91 BSD sources by
  105. <waltje@uWalt.NL.Mugnet.ORG> Fred van Kempen port and is availble as
  106. source:
  107.  
  108. tsx-11.mit.edu:pub/linux/packages/net/net-2/sources/lpd/ 
  109.  
  110. or as part of the net-2 binary release in:
  111.  
  112. tsx-11.mit.edu:pub/linux/packages/net/net-2/binaries/net-std.tar.z 
  113.  
  114. Original '91 BSD sources are all over the place.
  115.  
  116. ftp.uu.net:systems/unix/bsd-sources/usr.sbin/lpr/
  117. src.doc.ic.ac.uk:unix/bsd-sources/usr.sbin/lpr/
  118.  
  119. to name but two. The BSD sources have unGNU things in their Makefiles
  120. so they don't compile ``out of the box''.
  121.  
  122. Ross agrees that Fred's version should be thought of as _the_ Linux
  123. lpd package. I <B.A.McCauley@bham.ac.uk> have not had a chance to look
  124. at the differences in detail yet, but most of this FAQ refers to the
  125. BSD lpd package or Linux in general so this is probably not too
  126. important.
  127.  
  128. There are some other versions of lpd stuff about but I have to draw
  129. the line somewhere. If anyone whants to maintain FAQ sections on these
  130. they are welcome to do so. The other versions include plp and the ka9q lp
  131. facility. There are also rumours of SysV spoolers being ported.
  132.  
  133.  
  134.  XIV.03)  How do I get lpr to work properly other than for root? Where
  135. do the files go and what should their permissions be?
  136.  
  137. ANSWER: There is quite a bit of variation between the various releases
  138. but I'll try where possible to offer solutions that are universally
  139. applicable. Put /etc/lpd& in your /etc/rc or /etc/rc.local (usually in
  140. /etc/rc.local after you start syslogd (if you use syslogd)).
  141.  
  142. Set the group fields of the file permissons/ownership as follows:
  143.  
  144. -rwxr-s---   1 root     daemon      37892 Nov 19 23:32 /etc/lpd
  145. -rwx--s--x   1 root     daemon      21508 Nov 19 23:32 /usr/bin/lpc
  146. -rws--s--x   1 root     daemon      17412 Nov 19 23:32 /usr/bin/lpq
  147. -rwx--s--x   1 root     daemon      17412 Nov 19 23:32 /usr/bin/lpr
  148. -rwx--s--x   1 root     daemon      17412 Nov 19 23:32 /usr/bin/lprm
  149. -r-xr-xr-x   1 root     daemon       2816 May 10 13:37 /usr/bin/lptest
  150. srwxrwxrwx   1 root     daemon          0 Feb  4 20:54 /dev/printer
  151.  
  152. ...and for each of the spool directories listed in the sd fields of
  153. /etc/printcap... 
  154.  
  155. /usr/spool/lpd:
  156. total 5
  157. drwxrwxr-x   2 root     daemon       1024 May 18 23:00 .
  158. drwxr-xr-x  11 root     root         1024 Feb 19 20:56 ..
  159. -rw-rw-r--   1 root     daemon          4 May 18 23:00 .seq
  160. -rw-rw-r--   1 root     daemon         18 May 18 23:00 lock
  161. -rw-rw-r--   1 root     daemon         25 May 18 23:00 status
  162.  
  163. Note these 3 files are created by lpr and lpd so if you've never
  164. run these they could be missing so touch them into being.
  165.  
  166. In Fred's port the group is ``lp'' not ``daemon''. You don't need the
  167. socket /dev/printer for Fred's port as it keeps it's socket in
  168. /tmp/.printer and creates/deletes it as needed.
  169.  
  170. Some of these permissions may be overkill so don't be surprised if
  171. your system works with different permissions. The fact that lpq needs
  172. to be suid root is inelegant and may change in the future. People tell
  173. me that lpr must be setuid(root) but I've not seen evidence that this
  174. is really the case as long as the file permissions on the spool queues
  175. are right. Still as far as I know lpr is designed to be secure when
  176. installed setuid(root).
  177.  
  178. Alternative approach: just make lpc, lpr and lprm setuid(root) then
  179. you can almost forget the file permissions on the spool queues!
  180.  
  181. You're free to choose different directories for the executables on
  182. your system (notably lpc is usually in /etc even though it has
  183. commands that are useful to non-root).
  184.  
  185. There location of master lpd lock file is fixed at compile time. It is
  186. either in /usr/spool/lpd.lock or /var/spool/lpd/lpd.lock depending on
  187. which version of lpd you get.
  188.  
  189. My advise is keep your primary spool queue in /usr/spool/lpd and make
  190. /var a symlink to usr or keep it in /var/spool/lpd and make /usr/spool
  191. a symlink to ../var/spool. This gives the greatest compatibility with
  192. the pathnames that are compiled into the various distributed binaries.
  193.  
  194. The main configuration file is /etc/printcap although the old binaries
  195. look for it in /usr/etc/.  The old binaries' README says hosts.equiv
  196. and hosts.lpd files are looked for in /etc/inet but again the more
  197. accepted convention is to locate them in /etc.
  198.  
  199. Since, IMHO, working out in which particular etc directory each file
  200. should reside is tedious, I would advise having only one:
  201.  
  202. mv -i /usr/etc/inet/* /etc/inet/* /usr/etc/* /etc/
  203. rmdir /usr/etc/inet /etc/inet /usr/etc
  204. ln -s ../etc /usr/etc
  205. ln -s . /etc/inet
  206.  
  207. [But make sure the files in /usr/etc and /etc/inet are not already
  208. symlinks into /etc or you'll be in deep water.]
  209.  
  210. This makes your /etc huge but I think it's safe as I'm not aware of
  211. any packages that require different files or the same name in /etc and
  212. /usr/etc. [Health warning: this is IMHO - other people have different
  213. ideas.]
  214.  
  215.  
  216.  XIV.04)  What are all these diretrories for? (/etc, /usr/etc, /etc/inet,
  217. /usr/spool, /var/spool)
  218.  
  219. ANSWER: This is one to which I can't find a staight answer.
  220.  
  221. For various reasons including the difficulties of fsck'ing / some
  222. people like to put all things that aren't needed during bootstrap in
  223. /usr so that / is as small as possible. They therefore move
  224. unessential big files (usually the binaries) from /etc/ to /usr/etc/.
  225.  
  226. Unless you know what you are doing I'd advise keeping it all in /etc
  227. with /usr/etc and /etc/inet being symlinks back to /etc. (In fact
  228. these links are probably soon to be redundant as most recent binaires
  229. now look in /etc/.)
  230.  
  231. The alternative approach is to have a real /usr/etc directory
  232. containing all the non-essential stuff and make symlinks to each file
  233. therein from its namesake in /etc.
  234.  
  235. Also a few people like all their internet stuff in /etc/inet but as
  236. recent binaries excpect to find this stuff in /etc they must create
  237. links for each file from /etc into /etc/inet.
  238.  
  239. If you want to spread out your configuration files for the sake of
  240. tidiness then a better solution is to have a directory tree called
  241. /conf and make the files in /etc symlinks into this tree.
  242.  
  243. To avoid the problem of your /usr filesystem filling up as a result of
  244. stuff in spool queues some poeple perfer to keep their spool queues
  245. and such like in a separate filesystem called /var. If you don't have
  246. a /var file system then you should make /var a symlink to usr. If you
  247. _do_ have a /var filesystem to may want to make /usr/spool a symlink
  248. to ../var/spool so that any programs expecting to find /usr/spool will
  249. not be dissapointed.
  250.  
  251.  
  252.  XIV.05)  Why do I get ``jobs queued, but cannot start daemon'' or
  253. ``lpc: connect: No such file or directory'' ?
  254.  
  255. ANSWER: Firstly this "start" in the context of this error really means
  256. "wake". If ``ps ax'' does not reveal a lpd then you daemon has died
  257. (or was never started).
  258.  
  259. If you so have an lpd then you are having trouble with the socket
  260. connection to lpd.  I don't really understand this but the problem was
  261. common in early days with the old binaries but developments in the
  262. TCP/IP code in the kernel fixed it for most people. Using the new lpd
  263. from the net-2 package without the net-2 kernel stuff sometimes gives
  264. this problem.
  265.  
  266. When I get it I find that kill and restarting lpd a few times will
  267. eventually get rid of the problem. There has also been a suggestion
  268. that recompiling your kernel without TCP/IP at all can help. If
  269. linux-0.99pl10 with it's all new TCP/IP stuff doesn't fix this then
  270. further reserch is probably called for.
  271.  
  272.  
  273.  XIV.06)  Where do I get a printcap for a xxxxx?
  274.  
  275. ANSWER: This question is essentially meaningless - see next question.
  276.  
  277.  
  278.  XIV.07)  What is the content of /etc/printcap?
  279.  
  280. ANSWER: Given the similarity in appearence and name between
  281. /etc/termcap and /etc/printcap one could be forgiven for assuming that
  282. they contain analogous infomation. This is not the case. Whereas
  283. termcap contains informations about terminal *types* - (mostly escape
  284. seqences) printcap contains information about *specific* printers
  285. (like the directory that holds the spool queue and the device name of
  286. the printer). The information about a printer model's escape sequences
  287. and so on are held in the various filters which are _programs_ called
  288. by lpd to drive the printer. /etc/printcap simply gives the locations
  289. of these filters.  For details RTFM(printcap). [Alternatively the
  290. net-FAQ has a summary of some of the more important fileds.]
  291.  
  292. One last point you should always specify ``suppress header'' ``:sh:''
  293. unless you have *text* (_not_ postscript) printer and want banners. On
  294. a text printer they are usually a waste of time and paper. On a
  295. postscript printer they usually stop your printer working.  (See the
  296. banners question for further expanation).
  297.  
  298.  
  299.  XIV.08)  What is the format of a /etc/printcap?
  300.  
  301. ANSWER: Ideally RTFM(termcap) (yes, I said *termcap*) but since most
  302. people don't have TFM(termcap) here are the essentials.
  303.  
  304. Lines starting # are comments (as you might have guessed).
  305.  
  306. For each printer usable from the lpr command on your system there is
  307. one logical line in the file. For the sake of readability each logical
  308. line may be spread over several physical lines by making the last
  309. character on all but the last physical line a backslash.
  310.  
  311. Each logical line has the following format:
  312.  
  313. name1|name2|name3:string_capability=string:\
  314.        :numeric_capability#number:boolean_capability:
  315.  
  316. The leading spaces and colon on the second line are for readability
  317. only.
  318.  
  319. A printer can have as many names as you like but conventionally the
  320. final name is used as a longhand description of the printer. (Still
  321. people are free to say `lpr -P "Fred's grotty teletype"' if that's
  322. the description you've given.)
  323.  
  324. The list of capabilities can be as long as needed and the order is not
  325. significant. Each ``capability'' is denoted by a two character code.
  326. (The name ``capability'' comes form the file format's termcap heritage
  327. - parameter or attribute would be a more sensible terms.) [Note from
  328. Ross Biro: capabilities with 3 character names don't work properly
  329. which is why the serial port stuff in the old binaries failed.]
  330. Capabilities having string value and have a = delimiter between the
  331. capability name and the value while those having a numeric value use a
  332. # (actually they can use either a # or an =). Boolean ``capablilties''
  333. are true if they appear in the list and false if they do not.
  334.  
  335. Special characters in a string value can be expressed using `\'-escape
  336. sequences as in C; in addition, `\E' stands for ESC.  `^' is also a
  337. kind of escape character; `^' followed by CHAR stands for the
  338. control-equivalent of CHAR.  Thus, `^a' stands for the character
  339. control-a, just like `\001'. `\' and `^' themselves can be represented
  340. as `\\' and `\^' respectively. `\:' for `:' seems to work but the
  341. source code contains a comment to the effect that it is unsafe and
  342. `\072' is a better idea.
  343.  
  344. Example:
  345.  
  346. lp|bam|BAM's Epson FX-80:lp=/dev/lp1:sd=/usr/spool/lp1:sh:mx#0:\
  347.     :df=/usr/local/lib/magic-filter/lp.df:\
  348.     :if=/usr/local/lib/magic-filter/lp.if:
  349.  
  350. Name is lp (this is the printer that lpr uses by default). It's also
  351. known as bam or "BAM's Epson FX-80".
  352.  
  353. The printer is on /dev/lp1 (aka AT-bus LPT1:). I don't want a burst
  354. page. I don't want a file length limit. Files queued by `lpr -d' are
  355. passed through /usr/local/lib/magic-filter/lp.df and those queued by
  356. `lpr' through /usr/local/lib/magic-filter/lp.lf.
  357.  
  358. See also the next question.
  359.  
  360.  
  361.  XIV.09)  My /etc/printcap looks identical to someone else's but it
  362. doesn't work - why?
  363.  
  364. ANSWER: See if lpc stat reports a printer called ` :'. The last
  365. character on a continued line must be a \. If there are whitespace
  366. characters after the \ then it doesn't register the next line as a
  367. continuation.
  368.  
  369.  
  370.  XIV.10)  What's the minimum /etc/printcap?
  371.  
  372. ANSWER: This is a silly question but it _is_ frequently asked. The
  373. answer is ``lp:sh'' (that's 6 bytes including the required linefeed
  374. character on the end). To use this /etc/printcap you must make /dev/lp
  375. a symlink to your printer and create your spool queue directory as
  376. /usr/spool/lpd.  (You might think that if you wanted banner pages you
  377. could loose the ``:sh'' but the termcap syntax requires at least one
  378. capability per entry).
  379.  
  380.  
  381.  XIV.11)  How do I prevent the `staircase effect'?
  382.  
  383. ANSWER: Unix terminates each line of a file with a linefeed but not a
  384. carriage return so taken literally a Unix text file printed on an
  385. ASCII device will start each line below the end of the previous line.
  386. Some printers can be set to treat "linefeed" as "carriage return,
  387. linefeed", others can't. If yours can then do simply do that. If the
  388. printer cannot be fixed create a shell script filter that reads:
  389.  
  390. #!/bin/sh
  391. if [ $1 = -c ]; then
  392.   cat
  393. else
  394.   sed -e s/$/^M/
  395. fi
  396. echo -ne \\f
  397.  
  398. where ^M is a carriage return character not a ^ followed by a M.  To
  399. type ^M in emacs use the sequence C-q C-m and in vi use C-v C-m.
  400. Conventionally this script is called /usr/lib/lpf. The test of $1
  401. allows the isertion of carriage returns to be switched off by the `-l'
  402. switch on lpr.
  403.  
  404. Alternatively your printer may have an escape sequence that will set
  405. the way it handles linefeed characters. A simple filter that uses an 
  406. `echo -ne' command to send this sequence may be appropriate.
  407.  
  408. #!/bin/sh
  409. # Filter for HP printers to treat LF as CRLF  
  410. echo -ne \\033\&k2G
  411. cat
  412. echo -ne \\f
  413.  
  414. [Ross Biro's new release includes a slightly more complex filter
  415. stript called /usr/lib/hpof that does this and a few other things to
  416. make an HP printer behave sensibly even if it was in the wrong
  417. language when you started.]
  418.  
  419.  
  420.  XIV.12)  How do I get my printer to go back to the default font after
  421. each printout?
  422.  
  423. ANSWER: Either make your filters do it or define the `tr'
  424. ``capability'' in /etc/printcap to be your printer's font reset
  425. command. For details of the format of this string see the question on
  426. the format of printcap. This may not work if a printout crashes in the
  427. middle of an escape sequence - putting a lot of ^@ on the front may
  428. help but this probably won't be enough it you were printing raster
  429. graphics when the filter died.
  430.  
  431.  
  432.  XIV.13)  How do I prevent a formfeed at the end of every printout?
  433.  
  434. ANSWER: If you don't have an `if' specified in /etc/printcap then lpd
  435. will automatically put a formfeed at the end of each file. If you're
  436. using a filter then it's up to the filter to decide if it wants to put
  437. a formfeed. To disable formfeed completely if you don't have an `if'
  438. put :ff=: in your /etc/printcap.  But please note this suppresses the
  439. formfeed that would usually be printed if a filter dies. If you want
  440. formfeeds after text printouts but not on printouts printed with `lpr
  441. -l' then create the following `if' filter:
  442.  
  443. #!/bin/sh
  444. cat
  445. if [ "$1" != -c ]; then
  446.   echo -ne \\f
  447. fi
  448.  
  449. If you want a formfeed after `lpr -l' to be optional you can misuse the
  450. `-i' switch to suppress the formfeed with the following trick (after
  451. all `lpr -i -l' would usually not be implemented).
  452.  
  453. #!/bin/sh
  454. cat
  455. # use lpr -i -l to print raw without trailing formfeed
  456. if [ "$1" != -c -o "$4" = -i0 ]; then 
  457.   echo -ne \\f
  458. fi 
  459.  
  460.  
  461.  XIV.14)  How do I use a printer that's doesn't present a normal
  462. device interface?
  463.  
  464. ANSWER: [Firstly I'll explain the question.] The most common example
  465. is a printer that is connected via a network in some strange way.  For
  466. example consider a printer conneccted to a host running some esoteric
  467. OS with which you can only communicate via E-mail. To use this printer
  468. without going through lpr you would say something like:
  469.  
  470.   | uuencode tmp | mail printer-request@eosteric
  471.  
  472. in place of: 
  473.  
  474.   > /dev/lp
  475.  
  476. To use such a printer through lpr the ``lp'' capability of the print
  477. queue can be directed to /dev/null and _each_ filter must must
  478. explicitly uuencode and mail its output. In more complex cases if you
  479. already have an ``if'' or ``of'' filter for a strangely connected
  480. printer then other filters can pass their output to/through this
  481. filter to avoid duplication of effort.  In this case the ``if'' filter
  482. should usually be called with the ``-c'' switch to minimise the
  483. further manipulations if performs.
  484.  
  485.  
  486.  XIV.15)  How do I get burst/banner pages?
  487.  
  488. ANSWER: For a simple text printer (in particular not postscript) and a
  489. simple text banner simply take :sh: out of the printcap record. If you
  490. want to prevent the banner comming out in whatever font was last used
  491. on the printer then define the `tr' ``capability'' to be your
  492. printer's font reset command.
  493.  
  494. If you want a fancy cusomised banner (or have a postscript printer)
  495. leave :sh: in the printcap and make each of your filters print the
  496. banner. All the information to put on the banner is included in the
  497. filter's positional parameters.  RTFM(printcap) for details. [ If
  498. you're using <B.A.McCauley@bham.ac.uk>'s magic-filter package then
  499. call the code to print the banners from the config script. ]
  500.  
  501.  
  502.  XIV.16)  How do I print text on a PS printer?
  503.  
  504. ANSWER: You need a filter based on a program that converts ascii to
  505. postscript. The most well known of these is ``enscript'' but it's also
  506. the hardest to find. Others include ``a2ps'' and ``mpage'' (for
  507. details of these see the periodic c.o.l.a posting "How to print under
  508. Linux" by <gtaylor@god.hounix.org> Grant Taylor)
  509.  
  510. The nearest thing to enscript that an archie search revealed was a
  511. package called ``nenscript-1.13++.tar.Z'' deep in the guts of
  512. gatekeeper.dec.com which appears to do the job but it's prone to
  513. trimming off the tops of your pages.  (It didn't compile ``out of the
  514. box'' with the GNU libs but all it needed was one #undef.)
  515.  
  516. [I've not looked into these in detail as I don't have a PS printer. I
  517. would like someone to send me an exaple of a filter that they use
  518. using one of these.]
  519.  
  520.  
  521.  XIV.17)  Why do files with a lot of graphics get truncated?
  522.  
  523. ANSWER: Usually because you've got a limit set on the maximum size
  524. file that can sit in the spool queue. Put `mx#0' in your printcap.
  525.  
  526.  
  527.  XIV.18)  Why doesn't `lpr -i' work?
  528.  
  529. ANSWER: To get lpr -i to work you need a filter istalled as `if' that
  530. implements it.  The -i switch is simply passed on by lpd to the filter.
  531. There is such a filter usually called /usr/lib/lpf that can be obtained from
  532. bsd source archives in the directory bsd-source/lpr/filters.  It's also part
  533. of Fred's port but he put it in /usr/bin/.  If you whant to use this program
  534. but still want your filter to do some printer specific initialisation then
  535. write script thus:
  536.  
  537. #!/bin/sh
  538. # My initialisation stuff goes here
  539. exec /usr/lib/lpf $*
  540.  
  541.  
  542.  XIV.19)  Why doesn't `lpr -p' work?
  543.  
  544. ANSWER: Because it's broken. lpd always thinks that the printer is 0
  545. characters wide regardless of what printcap says. This is still broken
  546. in Ross's new release and Fred's port of the '91 sources. Looking at the
  547. sources the fix for Fred's port appears to be:
  548.  
  549. -------------------------------Cut Here-------------------------------------
  550. *** printjob.c.old    Sat Feb 27 14:07:01 1993
  551. --- printjob.c    Sun Jun  6 11:02:36 1993
  552. ***************
  553. *** 265,271 ****
  554.        */
  555.       for (i = 0; i < 4; i++)
  556.           strcpy(fonts[i], ifonts[i]);
  557. !     strcpy(width+2, "0");
  558.       strcpy(indent+2, "0");
  559.   
  560.       /*
  561. --- 265,271 ----
  562.        */
  563.       for (i = 0; i < 4; i++)
  564.           strcpy(fonts[i], ifonts[i]);
  565. !     sprintf(&width[2], "%d", PW);
  566.       strcpy(indent+2, "0");
  567.   
  568.       /*
  569. ***************
  570. *** 1081,1087 ****
  571.           FF = DEFFF;
  572.       if ((PW = pgetnum("pw")) < 0)
  573.           PW = DEFWIDTH;
  574. -     sprintf(&width[2], "%d", PW);
  575.       if ((PL = pgetnum("pl")) < 0)
  576.           PL = DEFLENGTH;
  577.       sprintf(&length[2], "%d", PL);
  578. --- 1081,1086 ----
  579. ----------------------------------Cut Here------------------------------
  580.  
  581. This patch is untested as I don't have a complete set of net-2 include
  582. files on my machine yet.
  583.  
  584. One other thing: lpd calls pr by full pathname so if you keep pr
  585. somewhere different from where lpd looks you will need a symlink.
  586. Where lpd expects to find pr varies from version to version but I
  587. think /usr/bin/pr is the usual place.
  588.  
  589.  
  590.  XIV.20)  Why does lprm say `too many users'?
  591.  
  592. ANSWER: This was a bug in the C library in the scandir() function
  593. which failed when an unsorted directory list was requested. This has
  594. been fixed now so just get a new libc.so. Alternatively there is a
  595. lprm with a workround (by toy@soho.crd.ge.com) in:
  596.  
  597. sunsite.unc.edu:/pub/Linux/system/Daemons/lprm-fix.tar.z
  598.  
  599.  
  600.  XIV.21)  Why does lpc complain that it hasn't stopped a daemon?
  601.  
  602. ANSWER: There's one lpd process that runs all the time and it spawns
  603. off children to handle each printer as needed. These children leave
  604. lock files lying about so lpc thinks that they are still running and
  605. tries to kill them. Was a bug but it was not serious and is fixed in
  606. the latest releases.
  607.  
  608.  
  609.  XIV.22)  Why does 
  610.  
  611.  
  612.  XIV.23)  How do I print over a Network?
  613.  
  614. ANSWER: To print on the printer "foo" connected to the machine
  615. "bar.baz.net" from the machine "mine.baz.net" you put an entry like
  616. this in your /etc/printcap (on mine.baz.net):
  617.  
  618. foo:lp=:rm=bar.baz.net:rp=foo:sd=/usr/lpd/spool/foo:
  619.  
  620. and, of course, create the spool directory /usr/lpd/spool/foo.
  621.  
  622. There's no point specitying filters and the like in
  623. mine.baz.net:/etc/printcap as it's the one in
  624. bar.baz.net:/etc/printcap that will get used.
  625.  
  626. On the machine bar.baz.foo, you need to put "mine.baz.net" on a line
  627. by itself in either /etc/hosts.equiv or /etc/hosts.lpd; note that
  628. putting it in /etc/hosts.equiv will allow for unauthenticated logins as
  629. well as printing.  /etc/hosts.lpd is printing only.
  630.  
  631. [ Editors note: I realise there are more questions about net printing
  632. but I don't know them. If you find any let me know (with answers if
  633. possible). See also the net FAQ ]
  634.  
  635.  
  636.  XIV.24)  Which /dev/lp* is my printer?
  637.  
  638. ANSWER: On an XT bus system LPT1: becomes /dev/lp0 (major=6, minor=0),
  639. on an AT LPT1: becomes /dev/lp1 (major=6, minor=1). To be more
  640. precise:
  641.  
  642. Name Major Minor I/O address
  643.  lp0   6     0       0x3bc
  644.  lp1   6     1       0x378
  645.  lp2   6     2       0x278
  646.  
  647.  
  648.  XIV.25)  When the kernel boots it says `using polling driver,' is
  649. there an interrupt driven driver?
  650.  
  651. ANSWER: Yes the latest kernels support parrallel port IRQs but to
  652. enable them you must ether: edit the IRQ number into lp_table[] in
  653. lp.c in the kernel source, or use `lpcntl'. The interrupt driver uses
  654. less processor time and gives a faster throughput but sometimes one
  655. may choose sacrifice this to free up an IRQ line. If your printer is
  656. /dev/lp1 using IRQ 7 put:
  657.  
  658. /etc/lpcntl /dev/lp1 7
  659.  
  660. in your /etc/rc.
  661.  
  662. If you don't have lpcntl get it from:
  663.  
  664. tsx-11.mit.edu:/pub/Linux/BETA/lp/lpirq.4.tar.Z
  665.  
  666.  
  667.  XIV.26)  What's the difference between the polling driver and an the
  668. interrupt driven one?
  669.  
  670. ANSWER: A polling sits in a loop repeatedly reading the port hardware
  671. to see if it is ready for another character and then gives it one. An
  672. interrupt driver goes to sleep and is woken by the port hardware
  673. (using a hardware interrupt) when it wants another character. Polling
  674. drivers are easier to write but in multitasking environments they are
  675. a bad thing.) I have seen some OSs for PC/AT machines where the
  676. polling printer drivers are more reliable than the interrupt ones but
  677. I doubt this is the case in Linux :-).
  678.  
  679.  
  680.  XIV.27)  How do I write filters?
  681.  
  682. ANSWER: In normal Unix terminology, filters are just programs (so they
  683. must have execute permission) that read a stream from their standard
  684. input and write to their standard output.
  685.  
  686. lpd filters are filters in the sense that thay read from their STDIN
  687. and write to their STDOUT but are not necessarily true filters in that
  688. they may assume that their standard input is a file and perform
  689. lseek() operations on it. I'm not sure that such filters are strictly
  690. conforming but they seem to work OK.
  691.  
  692. All lpd filters must conform to a particular command line syntax (or
  693. more often simply ignore command line parameters). For details of the
  694. command line parameters RTFM(printcap).
  695.  
  696. It's easier to debug filters if you test them in an immediate shell
  697. before you install them. (If your filter make use of its command line
  698. arguments you'll have to specify them too).
  699.  
  700. my-new-filter <file >/dev/lp1
  701.  
  702. If you want to write a shell script filter it must have a #!/bin/sh
  703. header.  Here for example is my Epson FX-80 dvi filter:
  704.  
  705. #!/bin/sh
  706. /usr/TeX/bin/dvips -f | \
  707. /usr/bin/gs -q -sDEVICE=eps9high -r120x216 -dNOPAUSE -sOutputFile=- -
  708.  
  709. More good specific examples can be found in the peroidic c.o.l.a
  710. posting "How to print under Linux" by <gtaylor@god.hounix.org> Grant
  711. Taylor. The document also explains to print out the types of file you
  712. wouldn't normally have a filter for eg. texinfo. (Not that you can't
  713. have a texinfo filter - I have one but it does leaver the printer
  714. idling for a long time while tex runs.)
  715.  
  716.  
  717.  XIV.28)  I've written a filter in shell script which works OK when I
  718. use it from the shell prompt but fails when I tell lpd to use it?
  719.  
  720. ANSWER: You may need a #!/bin/sh header. You may also need to set PATH
  721. within the script since the daemon's PATH may not have everything you
  722. need.
  723.  
  724.  
  725.  XIV.29)  When should I define an `of' filter?
  726.  
  727. ANSWER: Never. (Well strictly speaking there are circumstances but
  728. you're unlikey to meet them until you're so familar with lpd that you
  729. won't need this FAQ.)
  730.  
  731.  
  732.  XIV.30)  Where do I get filters for given printers?
  733.  
  734. ANSWER: From BSD source archives (I think). [Editors note: I need a
  735. better answer here ].
  736.  
  737. If you already have a program to print say DVI on your printer by some
  738. mechanism then making it into a filter is usually a matter of writting
  739. trivial shell script - see this FAQ. If the program you are using
  740. insists on reading a names file as input see the next question. Text
  741. mode filters are trivial too (see this FAQ) unless you want lpr to
  742. have a choice of fonts in which case they are slightly harder than
  743. trivial.  You will probably want to insert and `echo -ne' command at
  744. the beginning and end of your filter to set up the font etc to your
  745. liking.
  746.  
  747.  
  748.  XIV.31)  How do I get a program that won't read from STDIN to act as
  749. a filter?
  750.  
  751. ANSWER: For example dvilj2p insists on a named file as its input (and
  752. what's more expects one with a .dvi suffix). To make a dvi filter for
  753. a laserjet you'll have to capture the STDIN into a temporary file.
  754.  
  755. #!/bin/sh
  756. cat >/tmp/$$.dvi
  757. dvilj2p /tmp/$$
  758. rm /tmp/$$.dvi
  759.  
  760. The problem with this kludge is that is may have a very high disk
  761. overhead. (In the long term dvilj2p should be fixed).
  762.  
  763. If you have procfs you can use the following trick:
  764.  
  765. #!/bin/sh
  766. ln -s /proc/self/fd/0 /tmp/$$.dvi
  767. dvilj2p /tmp/$$
  768. rm /tmp/$$.dvi
  769.  
  770. Note: If it wasn't for the fact that dvilj2p adds a .dvi suffix you
  771. wouldn't need the temporary symlink and could just specify
  772. /proc/self/fd/0 directly. People who use this trick often usually keep
  773. permanent symlinks to /proc/self/fd/* in /dev.
  774.  
  775.  
  776.  XIV.32)  The set of filters supported by lpd seem strange - why
  777. aren't there filters for Postscript, GIF, TIFF and so on?
  778.  
  779. ANSWER: History. You can, in fact, use any of the filters (with the
  780. possible exception of the default filter) for any reason. If you're
  781. never going to use Benson Varian raster files you could use the -v
  782. switch for GIF files. Remember that if you create a filter for a file
  783. format that takes a long time to process then your printer may sit
  784. idle between print jobs even when there are things in the queue.
  785.  
  786. If you are on a network remember that the filter setups go on the
  787. print server so you will need to consider other people's needs too.
  788. One way to avoid running out of filter options is to define several
  789. logical printers in /etc/printcap that all point to the same physical
  790. one. One small problem with this is that you have no control over the
  791. order in which files from separate queues are printed. Another way to
  792. avoid running out of possible types is to use magic filters.
  793.  
  794.  
  795.  XIV.33)  What are magic filters?
  796.  
  797. ANSWER: Magic filters deduce their input files' types from `magic
  798. numbers' (distictive byte patterns at particular offsets).  Magic
  799. filters are usually perl scripts, shell scripts or C programs that
  800. simply identify the file type then call the appropriate non-magic
  801. filter. Blatent plug :-) I <B.A.McCauley@bham.ac.uk> have a generic
  802. magic filter bash script that selects the right filter to use based on
  803. the output of the `file' command. With my magic ``dvi'' filter (and
  804. 3 associated non-magic filters) I can do things like:
  805.  
  806. lpr -d file1.dvi file2.div.Z file3.ps file4.texinfo.z
  807.  
  808. (BTW confguring lpr to handle texinfo files getting a bit silly - see
  809. previous question).
  810.  
  811. This is now at:
  812.  
  813. tsx-11.mit.edu:pub/linux/sources/usr.bin/magic-filter-0.3.tar.gz
  814.  
  815. (Although the release number will doubtless change in future).
  816.  
  817. Other examples of magic filters (a simpler shell one and one in C)
  818. can be found in the periodic c.o.l.a posting "How to print under
  819. Linux" by <gtaylor@god.hounix.org> Grant Taylor.
  820.  
  821. Magic filters should never specified as `of' as the output filter only
  822. gets called once if a number of files are printed without a gap.
  823.  
  824. IMHO magic filters as `if' can also cause problems as they may prevent
  825. you, say, _listing_ a PostScript or nroff file. (Other people disagree
  826. as, if you are making your printer available on a network, it can be a
  827. pain having people accidently listing ps files.)
  828.  
  829.  
  830.  
  831. XV. UUCP/NEWS/MAIL for LINUX
  832. ============================
  833. *** This section is an expert of the UUCP-NEWS-MAIL-FAQ, posted twice
  834. *** monthly in c.o.l.a. This section and the complete FAQ about UUCP
  835. *** and others is written by Vince Skahan (vince@victoria.sea.wa.us),
  836. *** mail him for any corrections and information.
  837. ***
  838. *** Last update 93/06/11
  839.  
  840.  
  841. XV.A. General Information
  842. XV.B. UUCP
  843.  
  844. XV.C. News
  845. XV.D. Mail
  846.  
  847.  
  848. XV.A. General Information
  849. ~~~~~~~~~~~~~~~~~~~~~~~~~
  850.  
  851.   XV.01)  What uucp, news, and mail software works under Linux ?
  852.  
  853. ANSWER:
  854. Just about everything, most with no (or minimal) patching required...
  855.  
  856. The following is a quick but not all-inclusive list of software known to work
  857. under Linux:
  858.  
  859.     UUCP         - Taylor UUCP 1.04
  860.     News transport    - Cnews 12/22/91 patchdate (no 'optional' speedups)
  861.                           Cnews 'performance release' (needs patching)
  862.                           INN 1.4 (needs patching)
  863.                           dynafeed
  864.                           nntp 1.5.11 'reference' release, slurp 1.05
  865.     News readers    - tin-1.2-p0
  866.                           trn-2.5 (probably also 3.0)
  867.                           nn-6.4.18
  868.                           tass
  869.                           rn4.4
  870.                           waffle 1.65
  871.     Mail transport  - smail2.5
  872.                           smail3.1.28
  873.                           sendmail5.65c+IDA
  874.     Mail program    - elm2.4.21 (probably also 2.4.22)
  875.                           pine
  876.                           procmail
  877.                           deliver
  878.  
  879.   XV.02)  So where are the sources ?
  880.  
  881. ANSWER:
  882. At your friendly neighborhood archive site where you find sources normally.
  883. Consult archie for a list.
  884.  
  885. Config files for the portions of UUCP/News/Mail currently in the SLS
  886. distribution of Linux can be found on sunsite.unc.edu in the file
  887. sunsite.unc.edu:/pub/Linux/system/Mail/newspak-1.4.tar
  888.  
  889.   XV.03)  Do I really need the sources ?
  890.  
  891. ANSWER:
  892. Yes, if you want to *really* understand how the pieces are configured and
  893. how they fit together.  If you already know how...probably not unless you
  894. want to change the paths used or do custom patching for some reason.
  895.  
  896. There is considerable documentation in the sources that doesn't get
  897. "installed" that helps fill in the blanks between what you need to know, and
  898. what you can figure out.
  899.  
  900.   XV.04)  How do I get my system a news/mail/uucp feed ?
  901.  
  902. ANSWER:
  903.     Please see the "how to become a USENET site" periodic posting
  904.     in news.answers
  905.  
  906.  
  907. XV.B. UUCP
  908. ~~~~~~~~~~
  909.  
  910.   XV.05)  Why do I get 'timeout' on connections when I upgraded to
  911. uucp-1.04 ? 
  912.  
  913. ANSWER:
  914.     If you use a 'Direct' device in the Devices file, there's now a
  915.     10 second timeout compiled in.  Make the name of the Device anything
  916.     other than 'Direct'.
  917.  
  918.   XV.06)  Why doesn't anonymous uucp seem to work ?
  919.  
  920. ANSWER:
  921.     The SLS anonymous uucp only works in Taylor mode because it's
  922.     compiled with HAVE_TAYLOR_CONFIG.  If you want to do anon uucp in HDB
  923.     mode, you'll have to recompile the sources with just HDB defined.
  924.  
  925.     HDB mode also seems rather particular about things like blank spaces
  926.     and blank lines in your Permissions file.  If you get log file entries
  927.     that indicate 'no permission' for anon uucp, a good place to start is
  928.     to make sure that there are no blank lines (comment 'em out).
  929.  
  930.  
  931. XV.C News
  932. ~~~~~~~~~
  933.  
  934.   XV.07)   What newsreader is best ?
  935.  
  936. ANSWER:
  937.     No way I'll open that can of worms other than to say that you
  938.     definitely want something with "kill files" and probably want
  939.     something with 'threads'.  
  940.  
  941.     For what little it's worth, I use 'nn'.
  942.     
  943.   XV.08)  with trn - why do I get the message 'dbinit failed' ? 
  944.  
  945. ANSWER:
  946.     Because you didn't run mthreads from cron to keep the threads database
  947.     up-to-date.
  948.  
  949.   XV.09)  why is my 'nn' database getting continuously corrupted ?
  950.  
  951. ANSWER:
  952.     If you built it from sources and you asked for the 'words' method of
  953.     building the database,  it will definitely get corrupted if your
  954.     filesystem doesn't handle long filenames (ie...comp.os.linux.announce
  955.     is more than 14-characters).  Build it with the 'by-number' way of
  956.     creating the database and you'll be fine.
  957.  
  958.   XV.10)  why can't I post to moderated groups ?
  959.  
  960. ANSWER:
  961.     Probably because the newsreader is trying to call /bin/mail to send
  962.     the mail and it doesn't like it.  Replace the /bin/mail in SLS with
  963.     the port of mailx-5.3a.tar.z from the pub/Linux/system/Mail dir on
  964.     sunsite.unc.edu and make it mode 2755 and group mail (like 'elm') and
  965.     you'll be all set.
  966.  
  967.     Another possibility is that you have a moderated newsgroup set up on
  968.     your local system as not-moderated and somebody upstream is quietly
  969.     deleting the article (some system's software, not a person).  Make
  970.     sure you run a 'checkgroups' every now and then when the checkgroups
  971.     article rolls by in news.admin every few weeks.
  972.  
  973.   XV.11)  Why do I have problems that appear to be permission-related ?
  974.  
  975. ANSWER:
  976.     All the stuff in /usr/local/lib/news should be news.news except
  977.     /usr/local/lib/news/setnewsids which should be setuid root.
  978.  
  979.     Past versions of SLS had no 'news' group or user by default, which
  980.     caused lots of problems for people if they installed the news 
  981.     software *before* they added the 'news' group and user.
  982.  
  983.   XV.12)  Why doesn't SLS have the 'Performance Release' of C-news?
  984.       INN ? NNTP ? 
  985.  
  986. ANSWER:
  987.     Because SLS can't have *everything*.  It has the pre-performance C-news
  988.     because it's a very fast and stable implementation for non-nntp sites
  989.     that fits the needs of a normal uucp-only site.  If you're that into
  990.     having the most current of everything, you should probably be building
  991.     it from the sources.
  992.  
  993.   XV.13)  Why does doexpire say "severe space shortage" when there's
  994.     lots of room ? 
  995.  
  996. ANSWER:
  997.     Because it can't read /etc/mtab.  Make it mode 644.  This happens
  998.     when you unmount a mounted filesystem by root with a umask that
  999.     doesn't permit world-read of files owned by root.
  1000.  
  1001.   XV.14)  How do I set up NNTP?
  1002.  
  1003. ANSWER:
  1004.     Please see the extended description from Matt Welsh in the
  1005.     UUCP-NEWS-MAIL-FAQ that appears routinely in c.o.l.a.
  1006.  
  1007.  
  1008. XV.D. Mail
  1009. ~~~~~~~~~~
  1010.  
  1011.   XV.15)  Why is my hostname.domainname not in my headers and
  1012. something funky's there ? 
  1013.  
  1014. ANSWER:
  1015.     Because you didn't edit one or more of the following files like the
  1016.     README.linux files in the lib directories told you to:
  1017.  
  1018.         /usr/local/lib/smail/paths
  1019.         /usr/local/lib/smail/config
  1020.         /usr/local/lib/elm/elm.rc 
  1021.  
  1022.   XV.16)  Why can't elm write to my mailbox ?
  1023.  
  1024. ANSWER:
  1025.     You need elm and filter to be mode 2755 and group mail
  1026.     and also have /usr/spool/mail mode 775 and group mail.
  1027.  
  1028.  
  1029.   XV.17)  is sendmail+IDA available for Linux instead of smail ?
  1030.  
  1031. ANSWER:
  1032.    Yes !!! I've recently switched from smail to sendmail+IDA from the binary
  1033.    distribution on sunsite.unc.edu and it works great...and I'm a uucp-only
  1034.    site.  Look in pub/Linux/system/Mail for it...
  1035.  
  1036.  
  1037.  
  1038.        ===================8<==========>8================
  1039.  
  1040.  
  1041. -- 
  1042. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1043. #    LaBRI              |                        #
  1044. #  351 cours de la Liberation    |  e-mail:  corsini@geocub.greco-prog.fr   #
  1045. #  33405 Talence Cedex         |  e-mail:  corsini@labri.u-bordeaux.fr    #
  1046. #                   |                        #
  1047. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1048. -- 
  1049.      There will be a sig when our local net is reliable.
  1050.            For now, I would rather stay anonymous.
  1051.